package com.lx.oms.controller.service.impl;

import java.math.BigInteger;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.entity.R;
import com.lx.oms.common.utils.CommonUtils;
import com.lx.oms.controller.entity.WCategoryEntity;
import com.lx.oms.controller.manager.WCategoryManager;
import com.lx.oms.controller.service.WCategoryService;

/**
 * 微信类别
 *
 * @author houzhong
 * @date 2018年8月06日 上午11:40:32
 */
@Service("wCategoryService")
public class WCategoryServiceImpl implements WCategoryService {

	@Autowired
	private WCategoryManager wCategoryManager;

	@Override
	public Page<WCategoryEntity> listWCategory(Map<String, Object> params) {
		Query query = new Query(params);
		Page<WCategoryEntity> page = new Page<>(query);
		wCategoryManager.listWCategory(page, query);
		return page;
	}

	@Override
	public R saveWCategory(WCategoryEntity role) {
		int count = wCategoryManager.saveWCategory(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getWCategoryById(BigInteger id) {
		WCategoryEntity wCategory = wCategoryManager.getWCategoryById(id);
		return CommonUtils.msg(wCategory);
	}

	@Override
	public R updateWCategory(WCategoryEntity wCategory) {
		int count = wCategoryManager.updateWCategory(wCategory);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(String[] id) {
		int count = wCategoryManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
